Type CreditManagerFactory

	Global firstFactory:CreditManagerFactory

	Field nextFactory:CreditManagerFactory

	Function Fetch:CreditManager(name:String)
		Local factory:CreditManagerFactory=CreditManagerFactory.firstFactory
		While factory
			Local loader:CreditManager = factory.CreateLoader(name)
			If loader Then
				Return loader
			End If
			factory = factory.nextFactory
		Wend		
	End Function
	
	Method New()
		nextFactory = CreditManagerFactory.firstFactory
		CreditManagerFactory.firstFactory = Self
	End Method

	Method CreateLoader:CreditManager(name:String)
		Local n:String = name.ToLower()
		Select n
			Case "freeplay"
				Return New CreditManagerFreePlay
			Case "simple"
				Return New CreditManagerSimple
			Default
				Return Null
		End Select	
	End Method

End Type

New CreditManagerFactory